<?php
namespace app\common\model;

use think\Model;

class BisLocation extends BaseModel
{

    public function getFirstLocation($bisId = 1)
    {
        $data = [
            ['bis_Id','=', $bisId],
            ['status' ,'<>', -1],
        ];
        $order = [
            'listorder' => 'desc',
            'id' => 'desc'
        ];

        $result = $this->where($data)
            ->order($order)
            ->paginate();
        return $result;
    }

    public function getBisLocationByStatus($status = 0)
    {
        $order = [
            'id' => 'desc'
        ];
        $data = [
            'status' => $status
        ];
        return $this->where($data)->order($order)->paginate();
    }

    public function getNormalLocationByBisId($bisId)
    {
        $data = [
          'bis_id' => $bisId,
          'status' => 1,
        ];
        $result = $this->where($data)
            ->order('id', 'desc')
            ->select();
        return $result;
    }

    public function getNormalLocationsInId($ids)
    {
        $data = [
            'id' => ['id', 'in', $ids],
            'status' => 1,
        ];

        return $this->where($data)->select();
    }

}